{%extends "admin/base.html"%}
{%block title%}
创建书籍 - {{site["name"]|upper}}
{%endblock title%}

{%block metas%}
{{super()}}
{%endblock metas%}
{%block styles%}
{%if config.get("DEBUG")%}
{%include "_common-css.html"%}
<link rel="stylesheet" href="{{url_for("static", filename="css/admin/book.css")}}">
{%else%}
<link rel="stylesheet" href="{{url_for("static", filename="dist/css/book.min.css")}}">
{%endif%}

{{super()}}
{%endblock styles%}

{%block content%}

{%include "admin/_sidebar.html"%}

<div class="main">
    <div class="main-wraper">
        {%include "admin/_head.html"%}
    <div class="main-content">
        <div class="book-form">
            <ol class="breadcrumb">
                <li><a href="{{url_for("admin.index")}}">书籍</a></li>
                <li class="active">创建书籍</li>
            </ol> 
        <div class="panel">
            <div class="panel-body book-panel">

                <h3 class="title" >创建书籍</h3>

                <form id="new-book" action="{{url_for("admin.book_new")}}" method="post">
                    {{form.hidden_tag()}}
                    <div class="form-group">
                        <input class="form-control {%if form.name.errors%}input-error{%endif%}" name="name" type="text" {%if form.name.data%}value="{{form.name.data}}"{%endif%} autocomplete="off" placeholder="书名">
                        {%for error in form.name.errors%}
                        <div class="input-error-info">{{error.decode("utf-8")}}</div>
                        {%endfor%}
                    </div>
                    <div class="form-group">
                        <label for="brief">描述 <span class="gray-white">(可填)</span></label>
                        <textarea id="" class="form-control" name="brief" cols="30" rows="5" placeholder="描述">{%if form.brief.data%}{{form.brief.data}}{%endif%}</textarea>
                    </div>
                    <div class="form-group clearfix">
                        <div class="col-sm-6">
                            <label class="book-access" >
                                <input class="access-radio" type="radio" value="{{form.access.choices[0][0]}}" name="access" {%if form.access.data=="None" or form.access.data==form.access.choices[0][0]%}checked="checked"{%endif%}>
                                <i class="fa fa-columns access-icon"></i>
                                {{form.access.choices[0][1].decode("utf-8")}} <span class="gray-white">(任何人都能看到)</span>
                            </label>
                        </div>
                        <div class="col-sm-6">
                            <label class="book-access" >
                                <input class="access-radio" type="radio" value="{{form.access.choices[1][0]}}" name="access" {%if form.access.data==form.access.choices[1][0]%}checked="checked"{%endif%}>
                                <i class="fa fa-lock access-icon warn"></i>
                                {{form.access.choices[1][1].decode("utf-8")}} <span class="gray-white">(仅自己能看到)</span>
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-btn">
                        <button class="btn btn-default" type="submit">开始创建</button>
                        </div>
                    </div>
                </form>

            </div>
        </div>
        </div>
    </div>

    {%include "_footer.html"%}

    </div>


</div>


{%endblock content%}

{%block scripts%}
{%if config.get("DEBUG")%}
{%include "_common-js.html"%}
<script src="{{url_for("static", filename="asserts/cropit/dist/jquery.cropit.js")}}"></script>
{%else%}
<script src="{{url_for("static", filename="dist/js/common.min.js")}}"></script>
{%endif%}

{{super()}}
{%endblock scripts%}


